package com.ciis.testing.module;

import com.ciis.testing.ControllerTest;

/**
 * Created with IntelliJ IDEA.
 * User: zhangdajun
 * Date: 14-6-20
 * Time: 上午8:34
 * To change this template use File | Settings | File Templates.
 */
public class ModuleTest extends ControllerTest{

    /*@Autowired
    private ISysModuleService sysModuleService;

    //@Test
    public void testModule() throws Exception{
        MockHttpServletRequest request = new MockHttpServletRequest();
        MockHttpServletResponse response = new MockHttpServletResponse();
        request.setServletPath("/module/save");
        request.setParameter("id","1119");
        request.setParameter("is_leaf","0");
        request.setParameter("name","张达军测试4");
        request.setParameter("path","http://www.baidu.com");
        request.setParameter("is_refresh","1");
        request.setParameter("is_view","1");
        request.setParameter("directory","/测试/测试");
        request.setParameter("enable","1");
        request.setParameter("layout","1");
        request.setParameter("p_id","1118");
        request.setParameter("view_order","1");
        request.setParameter("level","0");
        request.setParameter("open_id","0");
        request.setParameter("icon","http://wwww.img.com");
        //request.setParameter("page","1");
        request.setMethod("POST");
        try {
            this.excuteAction(request, response);
            //返回值比较
            String result = response.getContentAsString();
            Assert.assertNotNull(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    //@Test
    public void testGetModule() throws Exception{
        MockHttpServletRequest request = new MockHttpServletRequest();
        MockHttpServletResponse response = new MockHttpServletResponse();
        request.setServletPath("/module/getModulePage");
        request.setParameter("level","0");
        request.setMethod("GET");
        try {
            this.excuteAction(request, response);
            //返回值比较
            String result = response.getContentAsString();
            Assert.assertNotNull(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    //@Test
    public void testModuleMenu() throws Exception{
        MockHttpServletRequest request = new MockHttpServletRequest();
        MockHttpServletResponse response = new MockHttpServletResponse();
        request.setServletPath("/module/getModuleMenu");
        request.setParameter("pId","1111");
        request.setMethod("GET");
        try {
            TSysUser user = new TSysUser();
            user.setId("admin");
            request.getSession().setAttribute(Constants.SESSION_USER,user);
            this.excuteAction(request, response);
            //返回值比较
            String result = response.getContentAsString();
            System.out.println(result);
            Assert.assertNotNull(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Test
    public void testGetRootMenu() throws Exception{
        MockHttpServletRequest request = new MockHttpServletRequest();
        MockHttpServletResponse response = new MockHttpServletResponse();
        request.setServletPath("/module/getRootMenu");
        request.setParameter("level","0");
        request.setMethod("GET");
        try {
            TSysUser user = new TSysUser();
            user.setId("admin");
            request.getSession().setAttribute(Constants.SESSION_USER,user);
            this.excuteAction(request, response);
            //返回值比较
            String result = response.getContentAsString();
            System.out.println(result);
            Assert.assertNotNull(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }*/
}
